CONTENTS | INDEX | PREV | NEXT
fdopen
NAME
fdopen - associate a file pointer with an already open file descriptor
SYNOPSIS
#include <stdio.h>
FILE *fp = fdopen(fd, modes);
int fd;
char *modes;
FUNCTION
fdopen associates an already open file descriptor with a file
pointer. Note that fclose()ing the file pointer will also
close() the file descriptor.
Refer to the fopen manual page for a description of available
modes. Note that when you use fdopen the file will not be
truncated and if you specify mode 'a' for append, the file
descriptor MUST have been open()'d with the O_APPEND flag.
That is, the mode string should be similar to the open flags
that were used to open the file descriptor.
NOTE
refer to the file_pointer manual page for general information
INPUTS
int fd; file descriptor to associated with a new file pointer
char *modes; modes string, such as "r+".
RESULTS
FILE *fp; new file pointer or NULL if an error occured
SEE ALSO
fopen, fread, fwrite, fgets, fputs